/*
	Credits to:
	- Spockholm, http://www.spockholm.com
	- Yevgen Silant'yev, http://joyka.pp.ua/
	- Pete Lundrigan, http://www.exellerate.com
	- Everyone helping with bugs and suggestions
	
	Changelog:
	RDF_1: based on Robber v1.03 beta
			- removed GA
			- introduced quickpause
	RDF_2: based on Robber v1.05 beta
	RDF_3: based on Robber v1.06 beta
	RDF_4: we are going too fast... introducing more delay
	RDF_5: tweakin' and tunin'
	RDF_6: based on Robber v1.07 beta
	RDF_7: based on Robber v1.08 beta
	RDF_8: keep on robbin' RDF...
*/

javascript: (function () {
if (navigator.appName == 'Microsoft Internet Explorer') {
	alert('You are using Internet Explorer, this bookmarklet will not work.\nUse Firefox or Chrome instead.');
}
else if (document.getElementsByName('mafiawars')[0]) {
	window.location.href=document.getElementsByName('mafiawars')[0].src;
	return;
}
else if (document.getElementsByClassName('canvas_iframe_util')[0]) {
	window.location.href=document.getElementsByClassName('canvas_iframe_util')[0].src;
	return;
}
else {
	document.body.parentNode.style.overflowY="scroll";
	document.body.style.overflowX="auto";
	document.body.style.overflowY="auto";
	try {
		document.evaluate('//div[@id="mw_city_wrapper"]/div',document,null,XPathResult.ORDERED_NODE_SNAPSHOT_TYPE,null).snapshotItem(0).style.margin="auto";
		if(typeof FB != 'undefined') {
			FB.CanvasClient.stopTimerToSizeToContent; 
			window.clearInterval(FB.CanvasClient._timer);
			FB.CanvasClient._timer=-1;
		}
		document.getElementById('mw_zbar').parentNode.removeChild(document.getElementById('mw_zbar'));
	}
	catch (fberr) {}
}
var version = 'Robber v1.08 beta - RDF version 8Stable',
exp = 0,
money = [],
roburl = [],
robstamina = [],
robname = [],
currentPageCount = 1,
content = document.getElementById('popup_fodder'),
combinedloot = '',
stamina = 0,
wait = 0,
slot = 0,
wait1 = 0,
wait2 = 0,
lootcount = 0,
run = false,
repeat = true,
full_boards = false,
loots = [],
stats = ['Done','Boards','Failed','Successful','Cleared'];
stats['Done'] = 0;
stats['Boards'] = 0;
stats['Failed'] = 0;
stats['Successful'] = 0;
stats['Cleared'] = 0;

var config_html = 
'<style type="text/css">'+
        '.messages img{margin:0 3px;vertical-align:top};'+
        '#close{display:inline};'+
'</style>'+
'<table class="messages">'+
        '<tr><td>Robber Configuration</td>'+
		'<td align="right" style="text-align:right;font-size:0.8em">'+version+' - Visit <a href="http://www.spockholm.com/mafia/bookmarklets.php?Robber" target="_top">Spockholm Mafia Tools</a> - <a href="http://www.spockholm.com/mafia/donate.php?Robber" alt="Donate a beer" target="_blank">PintWare</a> - <a href="#" id="close"><img src="http://www.spockholm.com/mafia/stop.gif" title="Close" width="16" height="16"></a></td></tr>'+
		'<tr><td>Delay interval:</td><td><input type="text" name="wait1" id="wait1" value="'+wait1+'" size="3">-<input type="text" name="wait2" id="wait2" value="'+wait2+'" size="3"> Delay in seconds between robbings.</td></tr>' +
////		'<tr><td>Repeat:</td><td><input type="checkbox" id="repeat" '+(repeat ? 'checked' : '')+' />Repeat the robbing?</td></tr>'+
////		'<tr><td>Only full boards:</td><td><input type="checkbox" id="full_boards" '+(full_boards ? 'checked' : '')+' />Stop running if you lack stamina to complete the full board?</td></tr>'+
        '<tr><td colspan="2"><a class="sexy_button" id="start">Start Robbing</a></td></tr>'+
'</table>';

var running_html = 
'<style type="text/css">'+
        '.messages img{margin:0 3px;vertical-align:top};'+
        '#close{display:inline};'+
'</style>'+
'<table class="messages">'+
        '<tr><td colspan="2" align="right" style="text-align:right;font-size:0.8em">'+version+' - Visit <a href="http://www.spockholm.com/mafia/bookmarklets.php?Robber" target="_top">Spockholm Mafia Tools</a> - <a href="http://www.spockholm.com/mafia/donate.php?Robber" alt="Buy me a beer" target="_blank">Donate a Pint</a> - <a href="#" id="close"><img src="http://www.spockholm.com/mafia/stop.gif" title="Close" width="16" height="16"></a></td></tr>'+
        '<tr><td>Log:</td><td><span id="status"></span></td></tr>'+
		'<tr><td>Stats:</td><td>Stamina Used: <span id="stamina" class="good"></span> &nbsp; Robberies: <span id="robberies_complete" class="good"></span> &nbsp; Boards: <span id="boards_complete" class="good"></span> <span id="boards_cleared" class="more_in"></span> &nbsp; Successful: <span id="success" class="good"></span> &nbsp; Failed: <span id="failed" class="bad"></span></td></tr>'+
		'<tr><td>Gained:</td><td>Exp: <span id="exp" class="good"></span> <span id="stamina_stats" class="more_in"></span> &nbsp; Money: <span id="money" class="good"></span><span id="money_stats" class="more_in"></span></td></tr>'+
		'<tr id="property_row"><td valign="top"><a href="#" id="property_logshow">Property Stats:</a></td><td id="propstats_log" style="display:none;"></td></tr>'+
		'<tr id="manual_loot"><td valign="top"><a href="#" id="looted_logshow">Loot:</a></td><td id="looted_log" style="display:none;"></td></tr>'+
		'<tr id="delay_row" style="display:none;"><td>Delay interval:</td><td><input type="text" name="wait1" id="wait1" value="'+wait1+'" size="3">-<input type="text" name="wait2" id="wait2" value="'+wait2+'" size="3"> Delay in seconds between robbings.</td></tr>' +
////		'<tr id="repeat_row" style="display:none;"><td>Repeat:</td><td><input type="checkbox" id="repeat" '+(repeat ? 'checked' : '')+' />Repeat the robbing?</td></tr>'+
////		'<tr id="full_board_row" style="display:none;"><td>Only full boards:</td><td><input type="checkbox" id="full_boards" '+(full_boards ? 'checked' : '')+' />Stop running if you lack stamina to complete the board?</td></tr>'+
		'<tr id="start_row" style="display:none;"><td colspan="2"><a class="sexy_button" id="start">Start</a></td></tr>'+
		'<tr id="stop_row"><td colspan="2"><a class="sexy_button" id="stop">Stop</a></td></tr>'+
'</table>';

function quickpause(seconds,resume_func) {
	var timer = setInterval(function(){//)
		seconds--;
		if (seconds<=0) {
			clearInterval(timer);
			if (typeof(resume_func) == 'function')
				resume_func();
		}
	},250);
}

function create_div() {
	if (document.getElementById('spockdiv')) {
		document.getElementById('spockdiv').innerHTML = config_html;
    }
	else {
		var spock_div = document.createElement("div");
		spock_div.id = 'spockdiv';
		spock_div.innerHTML = config_html;
		content.insertBefore(spock_div, content.firstChild);
    }
}

function close() {
	run = false;
	content.removeChild(document.getElementById("spockdiv"));
	return false;
}

function stop() {
	run = false;
	document.getElementById('start_row').style.display = '';
	document.getElementById('delay_row').style.display = '';
////	document.getElementById('repeat_row').style.display = '';
////	document.getElementById('full_boards').checked = full_boards;
////	document.getElementById('full_board_row').style.display = '';
	document.getElementById('stop_row').style.display = 'none';
	return false;
}

function start() {
	try { repeat = document.getElementById('repeat').checked; }
	catch (ignore) {}
////	full_boards = document.getElementById('full_boards').checked;
////	document.getElementById('full_boards').checked = full_boards;
	wait1 = parseInt(document.getElementById('wait1').value);
	wait2 = parseInt(document.getElementById('wait2').value);
	if (!run) {	document.getElementById('spockdiv').innerHTML = running_html; }
////	document.getElementById('full_boards').checked = full_boards;
	document.getElementById('looted_logshow').onclick = function () {
		my_toggle('looted_log');
	};
	document.getElementById('property_logshow').onclick = function () {
		my_toggle('propstats_log');
	};
	
	document.getElementById('wait1').value = wait1;
	document.getElementById('wait2').value = wait2;
	document.getElementById('close').onclick = close;
	document.getElementById('stop').onclick = stop;
	document.getElementById('start').onclick = start;
	var buttons = document.getElementsByClassName('rob_board')[0].getElementsByClassName('sexy_button_new short_red');
	//alert(buttons[0].onclick);
	run = true;
	for (i = 0; i < buttons.length; i++) {
		var temp = /["']remote(.*?)['"]/.exec(buttons[i].onclick);
		roburl[i] = 'remote'+temp[1].replace(/&amp;/g, "&");
		robstamina[i] = parseInt(document.getElementsByClassName('rob_prop_stamina')[i].innerHTML);
		try { 
			robname[i] = document.getElementsByClassName('rob_prop_name_short')[i].innerHTML; }
		catch (nameerr) {
		robname[i] = document.getElementsByClassName('rob_prop_name')[i].innerHTML;
		}
		robname[i] = robname[i].replace(/(<([^>]+)>)/ig,'');
		//console.log(i+' '+robname[i]);
		//console.log(i+' '+robstamina[i]);
	}
	if ((parseInt(document.getElementById('user_stamina').innerHTML) < array_sum(robstamina)) && full_boards) {
		////msg('<span class="bad">Not enough stamina to clear the board.</span> Have '+document.getElementById('user_stamina').innerHTML+' and need '+array_sum(robstamina)+' stamina.');
		////document.getElementById('start_row').style.display = '';
		////document.getElementById('delay_row').style.display = '';
		////document.getElementById('full_boards').checked = full_boards;
		////document.getElementById('full_board_row').style.display = '';
		////document.getElementById('repeat_row').style.display = '';
		////document.getElementById('stop_row').style.display = 'none';
		pausing(15, 'Not enough stamina to clear the board.  Have '+document.getElementById('user_stamina').innerHTML+' and need '+array_sum(robstamina)+' stamina.  Restarting robbing in ', start);
	}
	else {
		if (roburl[0] === undefined) {
			do_ajax('inner_page', 'remote/html_server.php?xw_controller=robbing&xw_action=refresh&xw_city=1', 1, 0, 0, 0);
			pausing(2, 'RELOAD - Restarting robbing in ', start);
		}
		else {
			currentPageCount = pageCount;
			document.getElementById('start_row').style.display = 'none';
			document.getElementById('delay_row').style.display = 'none';
////			document.getElementById('full_board_row').style.display = 'none';
////			document.getElementById('repeat_row').style.display = 'none';
			document.getElementById('stop_row').style.display = '';
			document.getElementById('inner_page').addEventListener('DOMSubtreeModified',state_change,false);
			//msg('Robbing slot '+roburl[0].substr(-1,1));
			if (wait1 == 0 && wait2 == 0) { quickpause(0,function(e) { do_ajax('',roburl[0],1,0,RobbingController.preRob(roburl[0].substr(-1,1)), RobbingController.rob); });}
			else {
					wait = myRandom(wait1, wait2);
					pausing(wait, 'Robbing next target in ', function(e) { do_ajax('',roburl[0],1,0,RobbingController.preRob(roburl[0].substr(-1,1)), RobbingController.rob); });
			}
		}
	}
}

create_div();
document.getElementById('close').onclick = close;
document.getElementById('start').onclick = start;

function msg(s) {
	document.getElementById('status').innerHTML = s;
}

function array_sum(s) {
	var sum = 0;
	for (i=0;i<s.length;i++) {
		sum+=parseInt(s[i]);
	}
	return sum;
}

function commas(s) {
	while (d = /(\d+)(\d{3}.*)/.exec(s)) {
		s = d[1] + ',' + d[2];
	}
	return s;
}

function my_toggle(s) {
	var p = document.getElementById(s);
	p.style.display = p.style.display == '' ? 'none' : '';
	return false;
}

//random value for delay
function myRandom(min, max) {
	return min + Math.floor(Math.round((Math.random() * (max - min))));
}

// deliberate pause from Vern's toolkit.js, http://vern.com/mwtools/
// given a number of seconds, an optional message and a resume
// function, will pause a few seconds and then execute the function
function pausing(seconds, message, resume_func) {
	// if the message was left out, shuffle things a bit
	if (typeof(message) == 'function') {
		resume_func = message;
		message = null;
	}
	if (message) message = message;
	else message = 'Pausing';
	msg(message + ' <span id="seconds">' + seconds + ' second' + (seconds == 1 ? '' : 's') + '</span>...');
	var timer = setInterval(function () { //)
		seconds--;
		if (document.getElementById('seconds')) document.getElementById('seconds').innerHTML = seconds + ' second' + (seconds == 1 ? '' : 's');
		else clearInterval(timer);
		if (seconds <= 0) {
			clearInterval(timer);
			if (typeof(resume_func) == 'function') resume_func();
		}
	},
    1000);
}

var reg_replace = ['Hyper Alert Sentry'];
var reg_targets = ['Hyper Alert Sentrie'];
var Diamonds = ['Hope Diamond','Koh-I-Noor Diamond','Great Star of Africa Diamond','Pair of The Orloff Diamond','Pair of The Sancy Diamond','Pair of The Idol\'s Eye Diamond','Pair of The Regent Diamond'];
function add_loot(s, c) {
	if (Diamonds.indexOf(s) > -1) {
		s = '<span class="money">Diamond!</span> '+s;
	}
	s = s.replace(reg_targets,reg_replace);
	var f = -1;
	for (var i = 0; i < loots.length && f == -1; ++i) {
		if (loots[i][0] == s) {
			f = i;
		}
	}
	if (c == null || c == undefined) c = 1;
	if (f != -1) {
		loots[f][1] += c;
	}
	else {
		loots[loots.length] = new Array(s, c);
	}
	var t = '';
	loots.sort();
	for (var i = 0; i < loots.length; ++i) {
		t += '<span class="good">' + loots[i][1] + 'x</span> ' + loots[i][0] + '<br />';
	}
	combinedloot = t;
	lootcount++;
	return false;
}
  
function state_change() {
	if(currentPageCount != pageCount) {
		currentPageCount = pageCount;
		document.getElementById('inner_page').removeEventListener('DOMSubtreeModified',state_change,false);
		if (wait1 == 0 && wait2==0) { quickpause(0, check_next);}
			else {
					wait = myRandom(wait1, wait2);
					pausing(wait, 'Robbing next target in ', check_next);
			}
	}
}
		  
function check_next() {
	currentPageCount = pageCount;
	parselog();
	if ((roburl.length > 0) && (run)) {
		var theslot = parseInt(roburl[0].substr(-1,1));
		//console.log(theslot+' '+robname[theslot]);
		document.getElementById('inner_page').addEventListener('DOMSubtreeModified',state_change,false);
		//msg('Robbing slot '+p(p(roburl[0].substr(-1,1))+1));
		msg('Robbing slot '+parseInt(theslot+1)+': '+robname[0]);
		//console.log('Robbing slot '+roburl[0].substr(-1,1));
		do_ajax('',roburl[0],1,0,RobbingController.preRob(theslot), RobbingController.rob);
	}
	else if ((repeat) && (run)) {
		//wait = myRandom(wait1, wait2);
		do_ajax('inner_page', 'remote/html_server.php?xw_controller=robbing&xw_action=refresh&xw_city=1', 1, 0, 0, 0);
		pausing(2, 'Restarting robbing in ', start);
	}
	else {
////		msg('Done robbing.');
////		document.getElementById('start_row').style.display = '';
////		document.getElementById('delay_row').style.display = '';
////		document.getElementById('repeat_row').style.display = '';
////		document.getElementById('full_board_row').style.display = '';
////		document.getElementById('stop_row').style.display = 'none';
		pausing(15, 'Waiting for stamina.  Restarting robbing in ', start);
	}
}
var propstats = {};
var success = [];
var failed = [];
function parselog() {
	slot = /slot=(\d+)/.exec(roburl[0])[1];
	s = document.getElementById('rob_slot_'+slot).innerHTML;
	//console.log('Parsing slot '+slot);
	propstats[robname[0]] == undefined ? propstats[robname[0]] = {"good":0,"bad":0,"name":robname[0]} : "";
	
	if (/Robbery Success/.test(s)) { 
		stats['Successful']++ 
		propstats[robname[0]].good > 0 ? propstats[robname[0]].good++ : propstats[robname[0]].good = 1;
	}
	if (/Robbery Failed/.test(s)) {
		stats['Failed']++
		propstats[robname[0]].bad > 0 ? propstats[robname[0]].bad++ : propstats[robname[0]].bad = 1;
	}
	//console.log(propstats[robname[0]].name+' Good: '+propstats[robname[0]].good+' Bad: '+propstats[robname[0]].bad);
	if (m = /(\d+) Experience/.exec(s)) {
		var xp = m[1].replace(/[^0-9]/g, '');
		exp += parseInt(xp);
	}
	if (m = /([A-Z]?\$)([\d,]+)/.exec(s)) {
		var c = /([A-Z]?\$)/.exec(m[1]);
		var cash = parseInt(m[2].replace(/[^0-9]/g, ''));
		if (money[c[1]] > 0) {
			money[c[1]] += cash;
		}
		else {
			money[c[1]] = cash;
		}
	}
	//var reg_targets = ['Hyper Alert Sentries',/$s/]
	//var reg_targets = ['Hyper Alert Sentry',/$s/]
	if (m = /alt="(.*?)"/.exec(s)) {
		//add_loot(m[1].replace(reg_targets,reg_replace));
		add_loot(m[1].replace(/[\ss]+$/,''));
	}
	if (m = /<div class="rob_res_expanded_details_item">((\d+)\s+)?(.*?)<\/div>/.exec(s)) {
		//add_loot(m[3].replace(reg_targets,reg_replace),parseInt(m[2]));
		add_loot(m[3].replace(/[\ss]+$/,''),parseInt(m[2]));
	}
	var moneyout = '';
    for (x in money) {
      if (money[x] > 0) {
        moneyout += x + commas(money[x]) + '&nbsp;';
      }
    }
	var propstatsout = '';
    for (x in propstats) {
		var total = parseInt(propstats[x].good+propstats[x].bad);
		var goodratio = parseFloat((propstats[x].good/total)*100).toFixed(0);
		var badratio = parseFloat((propstats[x].bad/total)*100).toFixed(0);
		propstatsout += propstats[x].name+': &nbsp; <span class="good">'+propstats[x].good+'</span> / <span class="bad">'+propstats[x].bad+'</span> <span class="more_in">('+goodratio+'% wins)</span><br />';
    }
	//console.log(propstatsout);
	//var popup = document.getElementById('inner_page').innerHTML;
	try {
		var level_pop = document.getElementsByClassName('level_up_pop')[0].firstChild.style.display; 
		if (level_pop == 'block') {
			var level_popid = document.getElementsByClassName('level_up_pop')[0].id;
			$('#'+level_popid).hide();
			$('#'+level_popid).fadeOut(200);
		}
	}
	catch (ignoree) {}
	var popup = document.getElementsByClassName('rob_pop')[0].firstChild.style.display;
	if (popup == 'block') {
		var popup_content = document.getElementsByClassName('rob_pop')[0].innerHTML;
		if (m = /(\d+) Bonus Experience/.exec(popup_content)) {
			stats['Boards']++;
			var xp = m[1].replace(/[^0-9]/g, '');
			exp += parseInt(xp);
		}
		if (m = /You\s+(earned|gained|received|collected)\s+(some|a|an)\s+bonus\s+(.+?)<\/div>/.exec(popup_content)) {
			//add_loot(m[3]);
			add_loot(m[3].replace(/[\ss]+$/,''));
			do_ajax('inner_page', 'remote/html_server.php?xw_controller=robbing&xw_action=refresh&xw_city=1', 1, 0, 0, 0);
		}
		if (/do not have enough stamina to rob/.test(popup_content)) {
			msg('Out of stamina.');
			run = false;
		}
		if (/Your record on this board was 9-0/.test(popup_content)) {
			stats['Cleared']++;
		}
		document.getElementsByClassName('rob_pop')[0].firstChild.style.display = 'none';
		document.getElementsByClassName('rob_pop')[0].childNodes[1].style.display = 'none';
		var popupid = document.getElementsByClassName('rob_pop')[0].id;
		$('#'+popupid).hide();
		$('#'+popupid).fadeOut(200);
		
		
	}
	
	//console.log(parseInt(robstamina[roburl[0].substr(-1,1)]));
	if (run) { stats['Done']++; }
	if (!isNaN(robstamina[roburl[0].substr(-1,1)])) { stamina += parseInt(robstamina[roburl[0].substr(-1,1)]); }
	//console.log(robstamina[roburl[0].substr(-1,1)]);
	document.getElementById('exp').innerHTML = exp;
	//document.getElementById('stamina').innerHTML = '('+parseFloat(exp/stamina).toFixed(2)+'/sta)';
	document.getElementById('stamina').innerHTML = stamina;
	document.getElementById('stamina_stats').innerHTML = '('+parseFloat(exp/stamina).toFixed(2)+' exp/sta)';
	document.getElementById('money').innerHTML = moneyout;
	document.getElementById('money_stats').innerHTML ='($' +commas(parseInt(parseInt(moneyout.replace(/[^0-9]/g, ''))/stamina))+'/sta)';
	document.getElementById('looted_log').innerHTML = lootcount+'/'+stats['Done']+' &nbsp; (' + (lootcount/stats['Done']*100).toFixed(1) + '%)<br />'+combinedloot;
	document.getElementById('propstats_log').innerHTML = propstatsout;
	document.getElementById('robberies_complete').innerHTML = stats['Done'];
	document.getElementById('boards_complete').innerHTML = stats['Boards'];
	document.getElementById('boards_cleared').innerHTML = '('+stats['Cleared']+')';
	document.getElementById('success').innerHTML = stats['Successful'] + ' ('+parseFloat(stats['Successful']/stats['Done']*100).toFixed(0)+'%)';
	document.getElementById('failed').innerHTML = stats['Failed'] + ' ('+parseFloat(stats['Failed']/stats['Done']*100).toFixed(0)+'%)';

	roburl=roburl.slice(1);
	robname=robname.slice(1);
	showall();
	stats_ratios();
	killall_popups();
}

function killall_popups() {
	var popups = document.getElementsByClassName('rob_pop');
	for (i=0;i < popups.length;i++) {
		popups[i].firstChild.style.display = 'none';
		popups[i].childNodes[1].style.display = 'none';
		var popupid = popups[i].id;
		$('#'+popupid).hide();
		$('#'+popupid).fadeOut(200);
	}
}

function showall() {
	RobbingController.openSlot(0);
	RobbingController.openSlot(1);
	RobbingController.openSlot(2);
	RobbingController.openSlot(3);
	RobbingController.openSlot(4);
	RobbingController.openSlot(5);
	RobbingController.openSlot(6);
	RobbingController.openSlot(7);
	RobbingController.openSlot(8);
}

function p(s) {
	return parseInt(s.replace(/,/g, ''));
}

function stats_ratios() {
	var expnow = document.getElementById('user_experience').innerHTML;
	var expnext = document.getElementById('exp_for_next_level').innerHTML;
	var energy = document.getElementById('user_energy').innerHTML;
	var stamina = document.getElementById('user_stamina').innerHTML;
	expneed = eval(expnext-expnow);
	ratiolvl=eval(expneed/energy);
	ratiolvl2=eval(expneed/stamina);
	ratiolvl3=eval(expneed/(parseInt(energy)+parseInt(stamina)));
	var d = 0;
	(Math.abs(ratiolvl)<10)?(d=2):(d=0);
	(Math.abs(ratiolvl2)<10)?(d2=2):(d2=0);
	(Math.abs(ratiolvl3)<10)?(d3=2):(d3=0);
	if(ratiolvl=='Infinity') { ratiolvl=0; d=0; }
	if(ratiolvl2=='Infinity') { ratiolvl2=0; d2=0; }
	if(ratiolvl3=='Infinity') { ratiolvl3=0; d3=0; }
	document.getElementById('user_stats').getElementsByClassName('stat_title')[0].innerHTML='Exp Need: <span class="energy_highlight">'+expneed+'</span><br>(<span class="energy_highlight">'+(ratiolvl).toFixed(d)+'</span><img src="http://mwfb.static.zynga.com/mwfb/graphics/icon_energy_16x16_01.gif" width="12" height="12" title="Exp needed per Energy">) (<span class="energy_highlight">'+(ratiolvl2).toFixed(d2)+'</span><img src="http://mwfb.static.zynga.com/mwfb/graphics/icon_stamina_16x16_01.gif" width="12" height="12" title="Exp needed per Stamina">) <span class="more_in">'+(ratiolvl3).toFixed(d3)+'</span>';

}

}())